package com.portal.cwegportal.mapper;

import com.portal.cwegportal.model.ReleaseScope;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@org.apache.ibatis.annotations.Mapper
@Repository
public interface ReleaseScopeMapper  extends Mapper<ReleaseScope> {

    int insertEleaseScopes(List<ReleaseScope> list);

    int getEleaseScope();

    @Select("update release_scope set is_deleted=1 where key_id=#{keyId} and publish_type=#{publishTypeId} and is_deleted=0 ")
    void deleteByKeyId(String keyId, String publishTypeId);

    @Select("select * from release_scope where key_id=#{keyId} and publish_type=#{publishTypeId} and is_deleted=0 ")
    public List<ReleaseScope> selectByPublishTypeKeyId( String keyId, String publishTypeId);
    //根据OrgId获取权限
    @Select("select * from release_scope where INSTR(#{orgIdPath},publishing_department_id) and publish_type =#{publisthType} and is_deleted=0")
    public List<ReleaseScope> selectByPrivilege(String orgIdPath, String publisthType);
}
